<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
$.extend($.fn.validatebox.defaults.rules, {  
    /*必须和某个字段相等*/
    equalTo: {
        validator:function(value,param){
            return $(param[0]).val() == value;
        },
        message:'字段不匹配'
    }
           
});
</script>
</head>
<body>

<form id="dept-add-dlg-form" action="StudentServlet.do?method=update"
		method="post">
		 <input type="hidden" name="id">
		<div class="datagrid-body">
			<table class="datagrid-btable" cellspacing="0" cellpadding="0"
				border="0" style="width: 100%;">
				<tbody>
		<tr class="datagrid-row">
						<td
							style="border-style: solid; width: 15%; text-align: right; padding-right: 7px">用户姓名</td>
						<td style="border-style: solid; width: 35%; text-align: left;">
							<input type="text" name="name"
							class="easyui-validatebox" style="width: 266px">
						</td>
					</tr>
					<tr class="datagrid-row">
						<td
							style="border-style: solid; width: 15%; text-align: right; padding-right: 7px">原密码</td>
						<td style="border-style: solid; width: 35%; text-align: left;">
							<input type="text" name="passWord"
							class="easyui-validatebox" style="width: 266px">
						</td>
					</tr>
					<tr class="datagrid-row">
						<td
							style="border-style: solid; width: 15%; text-align: right; padding-right: 7px">新密码</td>
						<td style="border-style: solid; width: 35%; text-align: left;">
							<input type="newpassword" id="newpassword" name="newpassword" required="true" value="" validType="length[4,8]"
							class="easyui-validatebox" style="width: 266px">
						</td>
					</tr>
					<tr class="datagrid-row">
						<td
							style="border-style: solid; width: 15%; text-align: right; padding-right: 7px">确认密码</td>
						<td style="border-style: solid; width: 35%; text-align: left;">
							<input type="newpassword" id="newtopassword" name="newtopassword" required="true"
							class="easyui-validatebox" validType="equalTo['#newpassword']" invalidMessage="输入密码不匹配"/ style="width: 266px">
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</form>
	<script type="text/javascript">
function getQueryParam(name) {
     var obj = $('#common-dialog').dialog('options');
     var queryParams = obj["queryParams"];
     return queryParams[name];
}
//自动填充值
function autoInput(obj){
 	$.each(obj, function(i, n){
	  //from 下的input
	  $("#dept-add-dlg-form input[name='"+i+"']").val(n);
	});
}
$(function(){
	var _id  =getQueryParam("id");
	$.getJSON("StudentServlet.do?method=edit",{id:_id},function(json){
			//自动添值
		  autoInput(json);
	});
});
</script>
</body>
</html>